﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Movies.Models;

namespace Movies.Controllers
{
    public class MoviesController : Controller
    {

       
        //
        // GET: /Movies/

        public ActionResult Index()
        {
            var ctx = new MoviesContainer();

            var movies = ctx.Movies.ToList();
            

            return View(movies);
        }

        public ActionResult Create()
        {
            return View();
        }

        [HttpPost()]
        public ActionResult Create(Movie movie)
        {
            if (ModelState.IsValid)
            {
                // add this to the database
              
                return RedirectToAction("index");
            }
            else
            {
                return View();
            }
        }


    }
}
